/**
 * TagDaoImp.java
 *
 *
 * $LastChangedBy: allen $
 * $LastChangedDate: 2007-11-26 17:40:14 +0800 $
 * $Revision: 1266 $
 */
package com.myspace.dao.hibernate;

import java.util.List;

import com.myspace.dao.TagDao;
import com.myspace.domain.Tag;
import com.myspace.common.exception.SystemException;
import com.myspace.common.util.DBUtil;

/**
 * Dao implements for tag
 *
 * @author Allen.Chen
 *
 */


public class TagDaoImp extends GenericDaoImp<Tag, Long> implements TagDao {

	@Override
	public void delete(Tag entity) {
		throw new SystemException("Tag can't be deleted!");
	}

	@Override
	public Tag update(Tag entity) {
		throw new SystemException("Tag can't be deleted!");
	}

	@SuppressWarnings("unchecked")
	public List<Tag> findTag(String[] tags) {
		if(tags == null || tags.length == 0)
			return null;
		String sql = "from Tag where name";
		sql = DBUtil.prepareString(sql, tags.length);
		return (List<Tag>)this.getHibernateTemplate().find(sql, tags);
	}

}
